####################################
# SCons build system for Pedigree
## Tyler Kennedy (AKA Linuxhq AKA TkTech)
####################################

import os
import shutil
import tempfile
Import(['env'])

tmp = env.Clone()

# Build directories
builddir = "#" + env["PEDIGREE_BUILD_BASE"]
kerneldir = "#" + env["PEDIGREE_BUILD_KERNEL"]
moduledir = "#" + env["PEDIGREE_BUILD_MODULES"]
subsysdir = "#" + env["PEDIGREE_BUILD_SUBSYS"]

# We output a single library, which applications link against to gain access to
# the implementation of the native subsystem classes.
native_userlib_objname = builddir + '/libpedigree.a'

env.Alias("libs", native_userlib_objname)

# To include a new subdirectory just add to the list.
subdirs = [

]

lib_files = [
    Glob("*.cc"),
    Glob("config/*.cc"),
    Glob("graphics/*.cc"),
    Glob("input/*.cc"),
    Glob("ipc/*.cc")
]

# To include a new directory for includes, just add it to the list
include = [
    '../include',
    '#/src/subsys',
    '#/src/system/include',
    '#/src/modules/system',
    '#/src/subsys/posix/include',
    '#/src/subsys/posix/include/c++/4.3.2',
    '#/src/subsys/posix/include/c++/4.3.2/i686-pedigree',
    '.'
]

# To add a library add to the list below
libraries = [
    'gcc'
]

# To add a library path add to the list below
libpaths = [
]

####################################
SConscript([os.path.join(i, 'SConscript') for i in subdirs],exports = ['tmp'])
tmp['CPPPATH'] = include
tmp['LIBS'] = libraries
tmp['CXXFLAGS'] = tmp['CXXFLAGS'].replace('-nostdinc', '')
tmp.Library(native_userlib_objname, lib_files)
